"""
英文字母个数

把1到5写成英文单词，分别是：one, two, three, four, five，这些单词一共用了3 + 3 + 5 + 4 + 4 = 19个字母。
把1到1000都写成英文单词，共用多少字母。【注： 不要算上空格和连字符。例如，342（three hundred and forty-two）
包含23个字母，而115（one hundred and fifteen）包含20个字母。单词“and”的使用方式遵循英式英语的规则】

"""
# e_word={0:'',1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',
#          8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',
#          14:'fourteen',15:'fifteen',16:'sixteen',17:'seventeen',18:'eighteen',
#          19:'nineteen',20:'twenty',30:'thirty',40:'forty',50:'fifty',60:'sixty',
#          70:'seventy',80:'eighty',90:'ninety',100:'hundred',1000:'onethousand'}

# def cnt(s):
#     n=0
#     for i in s:
#         if(i>='a' and i<='z'):
#             n+=1
#     return n





# 简化算法
e_word={0:0,1:3,2:3,3:5,4:4,5:4,6:3,7:5,
         8:5,9:4,10:3,11:6,12:6,13:8,
         14:8,15:7,16:7,17:9,18:8,
         19:8,20:6,30:6,40:5,50:5,60:5,
         70:7,80:6,90:6,100:7,1000:11}
sum_all=0
for j in range(1,1001):
    if(j<=20 or j==1000):       #1-20,1000
        sum_all+=e_word[j]
    elif j<100:     #21-99
        sum_all=sum_all+e_word[j-(j%10)]+e_word[j%10]
        
    else:
        if(j%100==0):       #整百 X00
            sum_all=sum_all+e_word[j//100]+e_word[100]
        elif (j%100<=20 or j%10==0):        #X01-X20 X30 X40 X50 X60 X70 X80 X90
            sum_all=sum_all+e_word[j//100]+e_word[100]+3+e_word[j%100]
        else:       #三位全部不为0的数  123 234.... 
            sum_all=sum_all+e_word[j//100]+e_word[100]+3+e_word[(j%100)-(j%10)]+e_word[j%10]
print(sum_all)




# an_dict={0:'',1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',
#          8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',
#          14:'fourteen',15:'fifteen',16:'sixteen',17:'seventeen',18:'eighteen',
#          19:'nineteen',20:'twenty',30:'thirty',40:'forty',50:'fifty',60:'sixty',
#          70:'seventy',80:'eighty',90:'ninety',100:'hundred',1000:'onethousand'}#数字英文字典
# fan=[]
# for i in range(1,1001):
#     if i<=20:
#         fan.append(an_dict[i])#不大于20都是固定的
#     elif i>20 and i<=100:
#         if i==100:
#             fan.append('onehundred')#表示100
#         else:
#             fan.append(str(an_dict[int(i/10)*10])+str(an_dict[i-int(i/10)*10]))
#     else:
#         if i==1000:
#             fan.append(an_dict[1000])
#         else:
#             if i-int(i/100)*100<=20 and i-int(i/100)*100>0 :
#                 fan.append(str(an_dict[int(i/100)])+str(an_dict[100])+
#                            str('and')+str(an_dict[i-int(i/100)*100]))
#             elif i-int(i/100)*100==0:
#                 fan.append(str(an_dict[int(i/100)])+str(an_dict[100]))
#             else:       fan.append(str(an_dict[int(i/100)])+str(an_dict[100])+str('and')+str(an_dict[i-int(i/100)*100-(i-int(i/10)*10)])+str(an_dict[i-int(i/10)*10]))
# #开始计数
# fanan=''
# for i in fan:
#     if i!='':
#         fanan+=i
# print(len(fanan))
# 答案：21124